import Vue from 'vue'
import Router from 'vue-router'
import AppHome from '@/view/index/Index.vue'
import UserInfo from '@/view/user/Index.vue'
import CarHome from '@/view/cars/Index.vue'
import ConferenceHome from '@/view/conference/Index.vue'

import ShopHomeRouter from '@/view/index/router'
import ShopPersonal from '@/view/user/router'
import CarCircle from '@/view/cars/router'
import CarConference from '@/view/conference/router'

Vue.use(Router)

const appChildRouters = Array.of(
	...ShopHomeRouter
)

export default new Router({
	linkActiveClass: 'router-link-active',
	hashbang: true,
	history: true,
	mode: 'hash',
	routes: [
		{
			path: '/', redirect: { name: 'MainConference' }
		},
		{
			path: '/',
			component: AppHome,
			children: appChildRouters,
			beforeEnter: (to, from, next) => {
				next()
			}
		},
		{
			path: '/',
			component: CarHome,
			children: CarCircle,
			beforeEnter: (to, from, next) => {
				next()
			}
		},
		{
			path: '/',
			component: ConferenceHome,
			children: CarConference,
			beforeEnter: (to, from, next) => {
				next()
			}
		},
		{
			path: '/',
			component: UserInfo,
			children: ShopPersonal,
			beforeEnter: (to, from, next) => {
				next()
			}
		}
	]
})
